package com.blt.car.me;

import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.util.TypedValue;
import android.view.View;

import com.blt.car.R;
import com.blt.car.base.BaseTitleBarActivity;
import com.blt.car.base.ViewHolder;
import com.blt.car.me.adapter.RoadCostFragmentAdapter;
import com.blt.car.widget.PagerSlidingTabStrip;

import java.util.ArrayList;

import blt.app_core.api.base.CoreManager;
import blt.app_core.api.purse.PayApi;


/**
 * Created by xgp on 2017/6/23.
 */

public class RoadCostDetailActivity extends BaseTitleBarActivity implements View.OnClickListener {

    // 指示器
    private PagerSlidingTabStrip tabs;
    private ViewPager viewPager;

    private ArrayList<Fragment> fragmentsList;
    private Fragment roadCostFragment, rechargeFragment, drawbackFragment;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_road_cost_detail;
    }

    @Override
    protected void initData() {
        super.initData();
    }

    @Override
    protected void initView(ViewHolder holder) {
        mTitleBar.setTitle("钱包明细");//过路费明细 充值明细 退款明细

        tabs = holder.get(R.id.tabs);
        viewPager = holder.get(R.id.vp_road_cost);

        fragmentsList = new ArrayList<Fragment>();
        roadCostFragment = new RoadCostFragment();
        fragmentsList.add(roadCostFragment);
        rechargeFragment = new RechargeFragment();
        fragmentsList.add(rechargeFragment);
        drawbackFragment = new DrawbackFragment();
        fragmentsList.add(drawbackFragment);

        viewPager.setAdapter(new RoadCostFragmentAdapter(getSupportFragmentManager(),
                fragmentsList));
        viewPager.setOffscreenPageLimit(3);

        final int pageMargin = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 4, getResources()
                .getDisplayMetrics());
        viewPager.setPageMargin(pageMargin);

        tabs.setViewPager(viewPager);
    }


    private void changeColor(int newColor) {
        tabs.setIndicatorColor(newColor);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
        }
    }
}
